<?php

class ver_productos extends CI_Controller {

    function __construct() {
        parent::__construct();
      
        $this->load->model('Productos_Model');
      $this->_is_logued_in();
      $this->load->library('table');
    
       
    }
 function _is_logued_in(){
      
        $is_logued_in = $this->session->userdata('is_logued_in');
      $user_id = $this->session->userdata('user_id');
        if ($is_logued_in != true OR $user_id == '') {
    
            redirect('dashboard');
            
        }
 }
    function index() {

        $data['title'] = 'Lista de Productos';
        $data['main_content'] = 'abm/lista_productos';
        $this->load->view('includes/template', $data);
    
    }
      function listar(){    
          
         
        
      // $data['consulta'] = $this->Productos_Model->listar_prod();
        //$this->load->view('abm/lista_productos', $data);
        $data['title'] = 'Lista de Productos';
        $data['main_content'] = 'abm/lista_productos';
        $this->load->view('includes/template', $data);
        
    
       $consulta = $this->db->get('productos');
           
}

 function portada_prod(){    
          
         
        
      // $data['consulta'] = $this->Productos_Model->listar_prod();
        //$this->load->view('abm/lista_productos', $data);
        $data['title'] = 'Lista de Productos';
        $data['main_content'] = 'productos/detalles_producto';
        $this->load->view('includes/template', $data );
        $unavariable = $_GET['variable'];

           
}

  function borrar_producto(){
        
         $data['title'] = 'Borrar Producto';
        $data['main_content'] = 'abm/borrar_producto';
        $this->load->view('includes/template', $data);
           $unavariable1 = $_GET['variable'];
        
        $this->db->delete('productos', array('id_producto' => $unavariable1));
       
    }




}
?>
